package edu.Test;

import java.util.Scanner;

public class test11 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        char[] b = a.toCharArray();
        int c = 0,c1 = 0;
        for (int i = 0; i < b.length; i++) {
            if(b[i]=='u'){
                c++;
            }else if(b[i]=='d'){
                c1++;
            }
        }
        if(c>c1){
            System.out.printf("%d",c-c1);
        }else if(c<c1){
            System.out.printf("%d",c-c1);
        }else if(c==c1){
            System.out.println(0);
        }
    }
}
